<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
  	<table class="tableForm addCargo">
		<tbody>
			<tr>
				<td class="tdLabel" width="120">
					出价：
				</td>
				<td class="tdValue">
					<input name="inviteCar.price" id="price" value=""/>
					<label id="price_tip" class="show">您对车辆所出的费用</label>
				</td>
			</tr>
			<tr>
				<td class="tdLabel">
					补充说明：
				</td>
				<td class="tdValue">
					<textarea name="inviteCar.otherInfo" id="otherInfo" rows="5" cols="45"></textarea>
				</td>
			</tr>
			<tr>
				<td class="tdLabel">
					
				</td>
				<td class="tdValue">
					<input type="button" onclick="inviteCar();" name="" value="邀请"/>&nbsp;&nbsp;<input type="button" onclick="simpleBox.close();" value="取消"/>
				</td>
			</tr>
  		</tbody>
  	</table>
  	<script>
  		function inviteCar()
  		{
  			var goodsId = "<s:property value='goodsId'/>";
  			var carId = "<s:property value='carId'/>";
  			var price = $("#price").val();
  			var otherInfo = $("#otherInfo").val();
  			
  			if(! /^\d+(\.\d+)?$/.test(price))
  			{
  				$("#price_tip").html("必须为整数或小数，小数点保留2位");
  				$("#price_tip").attr("class", "error");
  				
  				return false;
  			}
  			else
  			{
  				$("#price_tip").html("您对车辆所出的费用");
  				$("#price_tip").attr("class", "show");
  			}
  			
	  		$.ajax({
	  			  type: "POST",
	              url: "${pageContext.request.contextPath}/carJson/inviteCar.action",
	              data: {"inviteCar.goodsId" : goodsId,"inviteCar.carId" : carId, "inviteCar.price" : price, "inviteCar.otherInfo" : otherInfo},
	              dataType: "json",
	              success: function(data) 
	              {
	              	simpleBox.close();
	              	
	              	if(data.result.result == "success")
	              	{
	              		$("#operate_" + carId).html("已邀请");
	              	}
	              	else
	              	{
	              		alert(data.result.message);
	              	}
			   },
			   error: function()
			   {
			   		simpleBox.close();
			        alert("系统忙，请稍后再试。");
			   }
	  		})
  		}
  		
  	</script>
